<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<%
function cpf(aaTemp,iPost,iFlag)
  cpf=false
  if not CheckLogin then
    call ShowError(3)
    exit function
  end if
  if iPost="" or iFlag="" then exit function
  if not IsArray(aaTemp) then exit function
  if GetFlagValue(aaTemp,iPost)<iFlag then exit function
  cpf=true
end function


if not cpf(session("aaPostFlag"),0,1) then call ShowError(2)

'获取提交查询的参数
tx_search=trim(SafeRequest("tx_search",0))
ksrq=trim(SafeRequest("ksrq",0))
if ksrq<>"" then ksrq=cdate(ksrq)
jsrq=trim(SafeRequest("jsrq",0))
if jsrq<>"" then jsrq=cdate(jsrq)
re_table=SafeRequest("re_table",0)
re_operate=SafeRequest("re_operate",0)
re_username=SafeRequest("re_username",1)
search_count=trim(SafeRequest("search_count",1))

'组合sql查询字符串
'sql="select * from cdfee where true "
sql="select "
if search_count<>0 then sql=sql&" top "&search_count
sql=sql&" record.id,re_update,re_table,re_id,re_operate,clientip,clienthost,clientagent,re_memo,fullname,username.username from username right join (record left join client on client.id=record.re_clientid) on username.id=record.username where 1 "
if tx_search<>"" then
  sql=sql&" and (re_memo like '%"&tx_search&"%' or clientip like '%"&tx_search&"%' or clienthost like '%"&tx_search&"%' or clientagent like '%"&tx_search&"%')"
end if
if re_username<>0 then sql=sql&" and record.username="&re_username
if ksrq<>"" and jsrq<>"" then sql=sql&" and (re_update>=#"&ksrq&" 00:00:00# and re_update<=#"&jsrq&" 23:59:59#)"
' if ksrq<>"" and jsrq<>"" then sql=sql&" and (DateValue(re_update) between #"&ksrq&"# and #"&jsrq&"#)"   '非常之慢，不要使用
if re_table<>"" then sql=sql&" and re_table='"&re_table&"'"
if re_operate<>"" then sql=sql&" and re_operate='"&re_operate&"'"
sql=sql&" order by re_update desc,re_id desc"
' response.write sql
' response.end
'执行数据查询
set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
If rs.eof Then
  response.write("没有检索到数据!")
  response.end
End if

'分页控制
If saferequest("page",0)<>"" Then	page=clng(saferequest("page",0)) Else	page=1
pc=saferequest("pc",1)
If pc="" Then pc=25
rs.pagesize=pc
pagesize=rs.pagesize
pagecount=rs.pagecount
'page=clng(request.QueryString("page"))
if Not IsEmpty(page) then '如果page_num已经初始化...
  if Not IsNumeric(page) then '判断page_num值是否为数字
    page=1
  else
    page = clng(page) '接收page_num并化为数字型赋给page_num变量
  end if
  if page > pagecount then '如果接收的页数大于总页数
    rs.AbsolutePage = pagecount '设置当前显示页等于最后页
  elseif page <= 0 then '如果page小于等于0
    page=1
    rs.AbsolutePage = page '设置当前显示页等于第一页
  else
    rs.AbsolutePage = page '如果大于零,显示当前页等于接收的页数
  end if
  page = rs.AbsolutePage
end if
%>
<table class="full">
  <thead>
    <tr>
      <th scope="col">ID</th>
      <th scope="col">操作时间</th>
      <th scope="col">操作人员</th>
      <th scope="col">操作帐户</th>
      <th scope="col">操作项目</th>
      <th scope="col">操作编号</th>
      <th scope="col">操作内容</th>
      <th scope="col">操作详细</th>
      <th scope="col">操作人IP</th>
      <th scope="col">操作人HOST</th>
      <th scope="col">操作人AGENT</th>
      <th scope="col">备注</th>
    </tr>
  </thead>
  <tbody>
<%
  For i=1 To pagesize
    If rs.eof Then Exit for
    re_table=rs("re_table")
%>
    <tr>
      <th class="sub" scope="row"><%=rs.AbsolutePosition%></th>
      <td><%=rs("re_update")%></td>
      <td><%=rs("fullname")%></td>
      <td><%=rs("username")%></td>
      <td><%=dTable(re_table)%></td>
      <td><a href="<%if rs("re_table")="cd" then response.write("process") else response.write(rs("re_table"))%>.asp?rcd=no&id=<%=rs("re_id")%>" target="_blank"><%=rs("re_id")%></a></td>
      <td><%=rs("re_operate")%></td>
      <td><a class="res" href="<%=rs("id")%>" rel="res.asp?opt_id=<%=rs("id")%>">详细</a></td>
      <td><%=rs("clientip")%></td>
      <td><%=rs("clienthost")%></td>
      <td><%=rs("clientagent")%></td>
      <td><%=rs("re_memo")%></td>
    </tr>
<%
    rs.movenext()
  next
%>
  </tbody>
</table>
<div>
  <span id="pagebar">
    共查询到&nbsp;<%=rs.RecordCount%>&nbsp;条记录&nbsp;
    <%	If page>1 Then	%>
      [<a href="#" id="1">首页</a>]
      [<a href="#" id="<%=page-1%>">上一页</a>]
    <%
        End If
        If Not (page>=pagecount Or pagecount=0) Then
    %>
      [<a href="#" id="<%=page+1%>">下一页</a>]
      [<a href="#" id="<%=pagecount%>">尾页</a>]
    <%	End If %>
      第 <%=page%> 页 / 共 <%=pagecount%> 页
      转到<input id="page_val" type="text" size="2" maxlength="<%=Int(Log(pagecount))+1%>" value="<%=page%>" />页
      <input id="page_go" class="bt_button" type="button" value="Go" />
  </span>
</div>
<%
rs.close
Set rs=nothing
%>

<!--#include file="lib/connclose.asp"-->

